Page({
  data: {
    num: "",
    op: ""
  },
  result: null,
  isClear: !0,
  numBtn: function (t) {
    var s = t.target.dataset.val;
    this.isClear || "0" == this.data.num ? (this.isClear = !1, this.setData({
      num: s
    })) : this.setData({
      num: this.data.num + s
    })
  },
  opBtn: function (t) {
    var s = this.data.op,
      i = Number(this.data.num);
    this.setData({
        op: t.target.dataset.val
      }),
      this.isClear || (this.isClear = !0, null != this.result ? ("+" == s ? this.result = this.result + i : "-" == s ? this.result = this.result - i : "*" == s ? this.result = this.result * i : "/" == s ? this.result = this.result / i : "%" == s && (this.result = this.result % i), this.setData({
        num: this.result
      })) : this.result = i)
  },
  doBtn: function (t) {
    if (this.isClear)
      return this.setData({
        num: "0."
      }), void(this.isClear = !1);
    this.data.num.indexOf(".") >= 0 || this.setData({
      num: this.data.num + "."
    })
  },
  delBtn: function (t) {
    if (void 0 !== this.data.num.length) {
      var s = this.data.num.substr(0, this.data.num.length - 1);
      this.setData({
        num: "" == s ? "0" : s
      })
    }
  },
  resetBtn: function (t) {
    this.result = null,
      this.isClear = !0,
      this.setData({
        num: "0",
        op: ""
      })
  }
});